<!DOCTYPE HTML>
<html>
<head>
<#include "/adminPage/common.html"/>
<style type="text/css">
.layui-form-label {
	width: 140px;
}

.layui-input-block {
	margin-left: 170px;
}
</style>

</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">

		<#include "/adminPage/header.html"/>
		<#include "/adminPage/menu.html"/>

		<div class="layui-body">
			<!-- 内容主体区域 -->
			<div style="padding: 15px">
				<fieldset class="layui-elem-field layui-field-title">
					<legend>${menuStr.admin}</legend>
				</fieldset>

				<form action="${ctx}/adminPage/admin" id="searchForm" method="post">
					<div class="layui-form">
						<div class="layui-inline">
							<button type="button" class="layui-btn layui-btn-normal" onclick="add()">${adminStr.add}</button>
						</div>

						<div class="layui-inline">
							<button type="button" class="layui-btn" onclick="downApk()">${adminStr.downApk}</button>
						</div>

						<div class="layui-inline">
							<button type="button" class="layui-btn" onclick="readme()">${adminStr.readme}</button>
						</div>

						
						
						<div class="layui-inline">
							<div class="layui-form-mid layui-word-aux">${adminStr.notice}</div>
						</div>
						
						<div class="layui-inline">
							<button type="button" class="layui-btn layui-btn-normal" onclick="apiPage()">${adminStr.apiPage}</button>
						</div>
						<input type="hidden" name="curr" value="${page.curr}"> <input type="hidden" name="limit" value="${page.limit}">
					</div>
				</form>

				<table class="layui-table">
					<thead>
						<tr>
							<th>${adminStr.name}</th>
							<th>${adminStr.twoStep}</th>
							<th>${adminStr.privateKey} (${adminStr.remember})</th>
							<th>${adminStr.api}</th>
							<th>类型</th>
							<th>${commonStr.operation}</th>
						</tr>
					</thead>
					<tbody>
						<#list page.records as admin>
						<tr>
							<td>${admin.name}</td>
							<td><#if admin.auth> ${commonStr.yes} </#if> <#if !admin.auth> ${commonStr.no} </#if></td>
							<td><#if admin.auth> ${admin.key} <a href="javascript:qr('${admin.name}','${admin.key}')" style="color: blue; text-decoration: underline;">${adminStr.qr}</a> <a
									href="javascript:test('${admin.key}')" style="color: blue; text-decoration: underline;">${commonStr.test}</a> </#if></td>
							<td><#if admin.api> ${commonStr.yes} </#if> <#if !admin.api> ${commonStr.no} </#if></td>
							<td><#if admin.type==0> 管理员 </#if> <#if admin.type==1> 受限用户 </#if> </td>
							<td>
								<button class="layui-btn layui-btn-sm" onclick="edit('${admin.id}')">${commonStr.edit}</button>
								<button class="layui-btn layui-btn-danger layui-btn-sm" onclick="del('${admin.id}')">${commonStr.del}</button>
							</td>
						</tr>
						</#list>
					</tbody>
				</table>
				<div id="pageInfo"></div>
			</div>
		</div>
	</div>

	<div style="height: 0px; width: 0px; overflow: hidden;">
		<!-- 弹出框 -->
		<div class="layui-form" id="windowDiv" style="padding: 15px; display: none">
			<form id="addForm">
				<input type="hidden" name="id" id="id">

				<div class="layui-form-item">
					<label class="layui-form-label">${adminStr.name}</label>
					<div class="layui-input-block">
						<input type="text" name="name" id="name" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">${adminStr.pass}</label>
					<div class="layui-input-block">
						<input type="password" name="pass" id="pass" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">${adminStr.twoStep}</label>
					<div class="layui-input-block">
						<select id="auth" name="auth">
							<option value="false">${commonStr.no}</option>
							<option value="true">${commonStr.yes}</option>
						</select>
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">${adminStr.api}</label>
					<div class="layui-input-block">
						<select id="api" name="api">
							<option value="false">${commonStr.no}</option>
							<option value="true">${commonStr.yes}</option>
						</select>
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">用户类型</label>
					<div class="layui-input-block">
						<select id="type" name="type" lay-filter="type">
							<option value="0">管理员</option>
							<option value="1">受限用户</option>
						</select>
					</div>
				</div>
				
				<div class="layui-form-item" id="remoteTree" style="display: none;">
					<label class="layui-form-label">远程分组权限</label>
					<div class="layui-input-block">

						<div id="parentId"></div>
					</div>
				</div>

				<div class="layui-form-item center">
					<button type="button" class="layui-btn layui-btn-normal" onclick="addOver()">${commonStr.submit}</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">${commonStr.close}</button>
				</div>
			</form>
		</div>


		<div class="layui-form" id="qrDiv" style="padding: 15px; text-align: center; display: none">
			<img id="qrImg" src="">
		</div>


		<div class="layui-form" id="codeDiv" style="padding: 15px; display: none">
			<div class="layui-form-item">
				<label class="layui-form-label">${loginStr.authCode}</label>
				<div class="layui-input-inline">
					<input type="number" id="codeInput" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item center" style="text-align: right;">
				<input type="hidden" id="key">
				<button type="button" class="layui-btn layui-btn-normal" onclick="testOver()">${commonStr.submit}</button>
				<button type="button" class="layui-btn" onclick="layer.close(codeIndex)">${commonStr.close}</button>
			</div>
		</div>


		<div class="layui-form" id="downDiv" style="padding: 15px; display: none">
			<div class="layui-row">
				<div class="layui-col-md6">
					<div style="text-align: center;">
						<img id="androidImg" style="width: 200px;height: 200px;" src="${ctx}/adminPage/admin/qr?url=https://www.wandoujia.com/apps/8092183">
					</div>
					<div style="text-align: center;font-size: 16px;margin-top: 10px;">
						${adminStr.android}
					</div>
				</div>
				<div class="layui-col-md6">
					<div style="text-align: center;">
						<img id="iosImg" style="width: 200px;height: 200px;" src="${ctx}/adminPage/admin/qr?url=https://apps.apple.com/cn/app/google-authenticator/id388497605">
					</div>
					<div style="text-align: center;font-size: 16px;margin-top: 10px;">
						${adminStr.ios}
					</div>
				</div>
			</div>
		</div>

	</div>

	<#include '/adminPage/script.html'/>
	<script src="${ctx}/js/adminPage/admin/index.js?v=${jsrandom}" type="text/javascript"></script>
</body>


</html>